/**
 * @Description: NewsServiceImpl
 * @Author: Mr.Niu
 * @Date: 2022/9/20 17:22
 */
package com.zhiyou.crud.service.impl;

import com.zhiyou.crud.bean.News;
import com.zhiyou.crud.dao.DonateMapper;
import com.zhiyou.crud.dao.NewsMapper;
import com.zhiyou.crud.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import java.util.List;

@Service
public class NewsServiceImpl implements NewsService {
    @Autowired
    NewsMapper newsMapper;
    @Autowired
    DonateMapper donateMapper;
    @Override
    public List<News> getallnews() {
        Example example=new Example(News.class);
        example.setOrderByClause("nno desc");
        return newsMapper.selectByExample(example);
    }


    //单项支持人数。单项筹款金额，积累筹款金额
    public Integer[] getddj(){
        //积累筹款金额
        Integer sumdmoney = donateMapper.sumdmoney();
        //单项最高筹款金额
        Integer groupsum = donateMapper.Groupsum();
        //单项最高支持人数
        Integer groupdsb = donateMapper.Groupdsb();
        Integer[]  numbers = new Integer[]{groupdsb,sumdmoney,groupsum};
        return numbers ;
    }
}
